#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

void solve() {
    int n,p;
    cin >> n >> p;
    vector<long long> inv(n + 5);
    inv[1] = 1;
    for(int i = 2; i <= n; i ++) {
        inv[i] = (p - p / i) * inv[p % i] % p;
    }
    for(int i = 1; i <= n; i ++)
    {
        cout << inv[i] << endl;
    }
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt = 1;
    // cin >> tt;
    while (tt--) solve();
}
